using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 击退Buff数据
/// </summary>
[CreateAssetMenu(menuName = "创建ScriptableObject/BuffData/Knockback")]
public class KnockbackData : BuffData
{
    [Header("击退效果设置")]
    [Tooltip("击退距离")]
    public float Distance = 2.0f;
    
    [Tooltip("击退速度")]
    public float Speed = 10.0f;
    
    [Tooltip("击退力度")]
    public float Force = 10.0f;
    
    [Tooltip("击退方向类型")]
    public KnockbackDirectionType DirectionType = KnockbackDirectionType.FromCaster;
    
    [Tooltip("自定义击退方向（当DirectionType为Custom时使用）")]
    public Vector3 CustomDirection = Vector3.right;
    
    [Tooltip("是否在击退过程中造成伤害")]
    public bool DealDamageDuringKnockback = false;
    
    [Tooltip("击退过程中的伤害")]
    public long KnockbackDamage = 0;
    
    [Tooltip("是否在击退过程中眩晕目标")]
    public bool StunDuringKnockback = false;
    
    [Tooltip("击退过程中的眩晕时间")]
    public float StunDuration = 0.0f;

    private void OnValidate()
    {
        // 确保BuffType正确设置
        if (BuffType != BuffType.Knockback)
        {
            BuffType = BuffType.Knockback;
        }
        
        // 设置默认标签
        if (Tags == BuffTag.None)
        {
            Tags = BuffTag.Knockback;
        }
    }
}

/// <summary>
/// 击退方向类型
/// </summary>
public enum KnockbackDirectionType
{
    FromCaster,     // 从施法者方向击退
    ToCaster,       // 向施法者方向击退
    Custom,         // 自定义方向
    Random          // 随机方向
}